# 示例代码框架
phone_book = {}

def add_contact():
    name = input("请输入联系人姓名: ")
    phone = input("请输入电话号码: ")
    phone_book[name] = phone
    print(f"联系人 {name} 添加成功。")

def find_contact():
    name = input("请输入要查询的姓名: ")
    if name in phone_book:
        print(f"{name} 的电话是: {phone_book[name]}")
    else:
        print("未找到该联系人。")

def update_contact():
    name =input("请输入要更新的姓名")
    if name in phone_book:
        print("请输入新的电话号码")
        phone=input();
        phone_book[name]=phone;
    else:
        print("未找到该联系人。")

def delete_contact():
    name=input("请输入你要删除的联系人姓名")
    if name in phone_book:
        del phone_book[name]
        print(f"已将{name}的相关信息删除")
    else:
        print("未找到该联系人。")

def display_all():
    if not phone_book:
        print("字典为空。")
    else:
        print(phone_book)

def main():
    while True:
        print("\n电话簿菜单:")
        print("1. 添加联系人")
        print("2. 查询联系人")
        print("3. 更新联系人")
        print("4. 删除联系人")
        print("5. 遍历字典")
        print("0. 退出")
        choice = input("请输入你的选择: ")
        if choice == '1':
            add_contact()
        elif choice == '2':
            find_contact()
        elif choice=='3':
            update_contact()
        elif choice=='4':
            delete_contact()
        elif choice=='5':
            display_all()
        elif choice == '0':
            break

if __name__ == "__main__":
    main()